package com.ss.android.article.base.feature.app.a;

import com.ss.android.article.base.app.AppData;
import com.ss.android.common.util.Singleton;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public final class c {
    private static final Singleton a = new d();
    private static List b;

    public static boolean a(String arg2) {
        boolean v0;
        if (android.support.design.a.isTextEmpty(arg2)) {
            v0 = false;
        } else {
            if (!c.a(arg2, (List) c.a.get()) && !c.a(arg2, AppData.getInstance().getAppSettings().getSafeDomainList())) {
                return false;
            }

            v0 = true;
        }

        return v0;
    }

    private static boolean a(String arg6, List arg7) {
        boolean v0_2;
        int v0_1;
        if ((android.support.design.a.isTextEmpty(arg6)) || (android.support.design.a.isEmptyCollection(((Collection) arg7)))) {
            v0_2 = false;
        } else {
            Iterator v3 = arg7.iterator();
            do {
                if (v3.hasNext()) {
                    Object v0 = v3.next();
                    if ((android.support.design.a.isTextEmpty(arg6)) || (android.support.design.a.isTextEmpty(((String) v0)))) {
                        v0_1 = 0;
                    } else {
                        if (!arg6.equals(v0) && !arg6.endsWith("." + (((String) v0)))) {
                            v0_1 = 0;
//                            goto label_17;
                        } else {
                            v0_1 = 1;
                        }
                    }

                    label_17:
                    if (v0_1 == 0) {
                        continue;
                    }
                    break;
                } else {
                    return false;
                }
            }
            while (true);
            v0_2 = true;
            return v0_2;
        }

        return v0_2;
    }

    public static boolean b(String arg5) {
        boolean v0 = false;
        if (c.b == null) {
            c.b = new ArrayList();
            try {
                JSONArray v2 = AppData.getInstance().getAppSettings().getAllowedSchemeArray();
                int v1_1;
                for (v1_1 = 0; v1_1 < v2.length(); ++v1_1) {
                    c.b.add(v2.getString(v1_1));
                }
            } catch (JSONException v1) {
                return v0;
            }
        }

        return c.b.contains(arg5);
    }
}

